Skip to content

Conversation

@YugalPradhan31
Copy link
Contributor

No description provided.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use minimal APIs instead of controllers

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are following standard Template created by TeamsToolkit. Controller has been used in all standard templates.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are going to deprecate Controllers. Please use Minimal APIs instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated code to use minimal APIs and removed the controllers

/// <summary>
/// Removes bot mention from the message text.
/// </summary>
private string RemoveBotMention(string text)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function should be in the SDK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the custom Function RemoveBotMention.

}

// Loads and sends an adaptive card from the specified JSON file
private async Task SendAdaptiveCardAsync(IContext.Client client, string cardFileName, string userName = null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Cards API instead of JSON

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated code to use Cards API.

}
else
{
await client.Send(CommandString);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should pass the cancellationToken to all async functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image .Send() method accepts only 2 arguments (string , bool), It doesn't support cancellationToken.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh.. you are right. Can you file an issue in teams.net ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created Issue in Teams.net Issue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should be .gitignored, and add a launchSetting.example.json as a reference

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this file in .gitignore , also added launchSetting.example.json as a reference

<LangVersion>latest</LangVersion>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>14.0</LangVersion>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to use LangVersion?

We should enable nullable support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed LangVersion and added Nullable support.
image

<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.11" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.18.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Microsoft.Teams.Api" Version="2.0.*" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference only the top level package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and only kept by default created packages
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you only need Plugins.AspNetCore, all the other packages are transitive dependencies and dont need to be in the csproj

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

image

<PackageReference Include="Microsoft.Teams.Plugins.AspNetCore" Version="2.0.*" />
<PackageReference Include="Microsoft.Teams.Common" Version="2.0.*" />
<PackageReference Include="AdaptiveCards.Templating" Version="1.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to explicitly reference newtonsoft?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it.

</ItemGroup>

<!-- Exclude old Bot Builder files from compilation -->
<ItemGroup>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.


<!-- Exclude generated PolySharp files -->
<ItemGroup>
<Compile Remove="obj\**\PolySharp.SourceGenerators\**\*.g.cs" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this used? I'm not aware of the need to use PolySharp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

</ItemGroup>

<!-- Exclude local settings from publish -->
<ItemGroup>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove, use defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

"Teams": {
"ClientId": "",
"ClientSecret": "",
"BotType": "",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is BotType? I dot not recognize this setting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all BotType references.

@@ -0,0 +1,19 @@
<Project>
<PropertyGroup>
<PolySharpIncludeGeneratedTypes>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the file.

var config = builder.Configuration.Get<ConfigOptions>();

// Factory function to create access tokens using managed identity credentials
Func<string[], string?, Task<ITokenResponse>> createTokenFactory = async (string[] scopes, string? tenantId) =>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we merge MSAL support, we won't need this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the fuction.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is usually gitignored.. what's the reason to commit it?

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is required, if we remove this , these options will not be visible.
image

> NOTE: When you create your app registration, you will create an App ID and App password - make sure you keep these for later.

2. Run ngrok - point to port 3978
2. Run ngrok - point to port 5130

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not lead with ngrok, we should prioritize devtunnels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the README to prioritize dev tunnels over ngrok.

* Leave **Redirect URI** empty.
* Choose **Register**.
B) On the overview page, copy and save the **Application (client) ID, Directory (tenant) ID**. You'll need those later when updating your Teams application manifest and in the appsettings.json.
B) On the overview page, copy and save the **Application (client) ID, Directory (tenant) ID**. You'll need those later when updating your Teams application manifest and in the appsettings.Development.json.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case do we need the TenantID in the manifest?

appSettings.Development.json is just one way of providing values to IConfiguration. Instead of this file, I'd recommend launchSettings.json

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Readme.
image

- Modify the `/appsettings.Development.json` and fill in the following details:
- `ClientId` - Generated from Step 1 is the application app id
- `ClientSecret` - Generated from Step 1, also referred to as Client secret
- `BotType` - Set the bot type (e.g., "MultiTenant" or "SingleTenant")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not doing multitenant anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed BotType entirely.

<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Microsoft.Teams.Api" Version="2.0.*" />
<PackageReference Include="Microsoft.Teams.Apps" Version="2.0.*" />
<PackageReference Include="Microsoft.Teams.Plugins.AspNetCore" Version="2.0.*" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference only the top level package

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and only kept by default created packages and moved sample to different PR:
#1853

<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Content Remove="appsettings.Development.json" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are by default created.

if (member.Id != activity.Recipient.Id)
{
await client.Send("Welcome to the suggested actions bot. This bot will introduce you to suggested actions. Please answer the question:");
await SendSuggestedActionsCardAsync(client, log);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cancellationToken

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image .Send() method accepts only 2 arguments (string , bool), It doesn't support cancellationToken.

"commandName": "Project",
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7130;http://localhost:5130",
"applicationUrl": "http://localhost:5130",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should standarize to 3978

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to 3978 and moved Sample to different PR: #1854

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having one action per sample/language will lead to 202 actions. We should have only one, or one per language max.

Copy link
Contributor Author

@YugalPradhan31 YugalPradhan31 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted the file, we will update one single file.


# User-specific files
*.user
launchSettings.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you .gitignore launchSettings.json from the top .gitignore? it will be applicable to all samples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added launchSettings.json in root level .gitgnore

image

@YugalPradhan31 YugalPradhan31 changed the title Update sample from Bot Builder SDK to Teams PR-6 Bot Builder SDK to Teams SDK bot-adaptive-card-actions sample Jan 19, 2026
@YugalPradhan31 YugalPradhan31 changed the title Bot Builder SDK to Teams SDK bot-adaptive-card-actions sample Botbuilder SDK to Teams SDK bot-adaptive-card-actions sample Jan 19, 2026
@Harikrishnan-MSFT Harikrishnan-MSFT changed the title Botbuilder SDK to Teams SDK bot-adaptive-card-actions sample Migrate BotBuilder SDK to Teams SDK bot-adaptive-card-actions sample Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants